package zhongbo.java.air.flightpath.listener;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.connection.Message;
import org.springframework.data.redis.connection.MessageListener;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;


@Component
public class RedisSubscribeLogChanelListener implements MessageListener {

    @Autowired
    private RedisTemplate<String,Object> redisTemplate;

    /**
     * 接受广播消息
     * @param message
     * @param bytes
     */
    @Override
    public void onMessage(Message message, byte[] bytes) {
        String msg = redisTemplate.getStringSerializer().deserialize(message.getBody());

        System.out.println("广播消息内容：" + msg);
    }
}
